package com.study.modules.saas.repository.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.study.modules.saas.repository.model.RoleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RoleDao extends BaseMapper<RoleDO> {

    @Select("SELECT "
            + " r.*  "
            + "FROM "
            + " role r "
            + " LEFT JOIN user_role ur ON r.id = ur.role_id  "
            + "WHERE "
            + " ur.user_uuid = #{uuid} "
            + " AND r.`status` = 'ENABLE' ")
    RoleDO selectRoleByUuid(@Param("uuid") String uuid);

}
